<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet"
	type="text/css" />
<link href="http://cdn.bootcss.com/bootstrap/3.3.6/css/bootstrap.css"
	rel="stylesheet" type="text/css" />
<link href="lib/region/css/city-picker.css" rel="stylesheet"
	type="text/css" />
<link href="lib/region/css/main.css" rel="stylesheet" type="text/css" />

<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>新增U_org</title>
</head>
<body>
	<div class="pd-20">
		<form action="<%=path%>/backstage/u_org-add" method="post"
			class="form form-horizontal" id="form-u_org-add">
			<input type="hidden" id="orgid" name="orgid" value='${u_org.id}' />

			<div class="row cl">
				<label class="form-label col-2">核伙公司编码：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.corp_code}"
						placeholder="" id="" name="corp_code" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<%-- <div class="row cl">
				<label class="form-label col-2">核伙人机构当前人员数，用于生成会员代码：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.cur_index}"
						placeholder="" id="" name="cur_index" datatype="*" nullmsg="不能为空">
				</div>
			</div> --%>
			<div class="row cl">
				<label class="form-label col-2">公司全称：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.corp_fname}"
						placeholder="" id="" name="corp_fname" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">公司简称：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.corp_sname}"
						placeholder="" id="" name="corp_sname" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">所属行业：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.belong}"
						placeholder="" id="" name="belong" datatype="*" nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">总部地址省市：</label>
				<div class="formControls col-2">
					<input id="city-picker3" class="form-control" readonly
						name="address" type="text" value="${u_org.address}"
						data-toggle="city-picker">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">公司规模：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.corp_size}"
						placeholder="例：5—10" id="" name="corp_size" datatype="*"
						nullmsg="不能为空">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-2">公司网址：</label>
				<div class="formControls col-2">
					<input type="text" class="input-text" value="${u_org.url}"
						placeholder="" id="" name="url" datatype="*" nullmsg="不能为空">
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">Logo：</label>
				<div class="formControls col-6">
					<div id="fileList_logo" class="uploader-list"></div>
					<div id="filePicker_logo">选择图片</div>

					<input type="hidden" class="input-text" value="${u_org.logo}"
						placeholder="" id="logo" name="logo" datatype="*" nullmsg="不能为空">
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">公司简介：</label>
				<div class="formControls col-2">
					<textarea style="width: 500px; height: 100px;" id=""
						name="description" datatype="*" nullmsg="不能为空">
					${u_org.description}
					</textarea>
				</div>
			</div>

			<div class="row cl">
				<label class="form-label col-2">背景图片：</label>
				<div class="formControls col-6">
					<div id="fileList_back" class="uploader-list"></div>
					<div id="filePicker_back">选择图片</div>

					<input type="hidden" class="input-text" value="${u_org.back_img}"
						placeholder="" id="back_img" name="back_img" datatype="*"
						nullmsg="不能为空">
				</div>
			</div>

			<div class="row cl">
				<div class="col-10 col-offset-2">
					<button onClick="u_org_save_submit();"
						class="btn btn-primary radius" type="submit">
						<i class="Hui-iconfont">&#xe632;</i> 保存并提交
					</button>
					<button onClick="layer_close();" class="btn btn-default radius"
						type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
				</div>
			</div>
		</form>
	</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script>
	<script type="text/javascript"
		src="lib/Validform/5.3.2/Validform.min.js"></script>
	<script type="text/javascript"
		src="lib/webuploader/0.1.5/webuploader.min.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/ueditor.config.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/ueditor.all.min.js"></script>
	<script type="text/javascript"
		src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
	<script type="text/javascript" src="lib/region/js/city-picker.data.js"></script>
	<script type="text/javascript" src="lib/region/js/city-picker.js"></script>
	<script type="text/javascript" src="lib/region/js/main.js"></script>
	<script type="text/javascript">
		function u_org_save_submit() {
			$("#form-u_org-add").Validform({
				tiptype : 2,
				ajaxPost : true,
				callback : function(form) {
					var index = parent.layer.getFrameIndex(window.name);
					if (index) {//关闭弹出层
						parent.$('.btn-refresh').click();
						parent.layer.close(index);
					} else {//单独的页面
						location.href = "%=path%>/backstage/shop-list";
					}
				}
			});
		}
	</script>
	<script type="text/javascript">
	// 图片上传demo
	$(function() {

		/*企业Logo上传*/
	    var $list = $('#fileList_logo'),
			$list_back = $('#fileList_back'),
	        ratio = window.devicePixelRatio || 1,
	        thumbnailWidth = 100 * ratio,
	        thumbnailHeight = 100 * ratio,
			uploader,uploader_back;

		uploader = WebUploader.create({
	        auto: true,
	        swf: 'lib/webuploader/0.1.5/Uploader.swf',
	        server: '<%=path%>/backstage/common/uploadPic',
	        pick: '#filePicker_logo',
	        accept: {
	            title: 'Images',
	            extensions: 'gif,jpg,jpeg,bmp,png',
				mimeTypes: 'image/jpg,image/jpeg,image/png'
	        },
	        formData: {  
	        		foldername: 'logo'
	        }  
	    });

	    uploader.on( 'fileQueued', function( file ) {
	        var $li = $(
	                '<div id="' + file.id + '" class="file-item thumbnail">' +
	                    '<img>' +
	                    '<div class="info">' + file.name + '</div>' +
	                '</div>'
	                ),
	            $img = $li.find('img');

	        $list.append( $li );
	        uploader.makeThumb( file, function( error, src ) {
	            if ( error ) {
	                $img.replaceWith('<span>不能预览</span>');
	                return;
	            }

	            $img.attr( 'src', src );
	        }, thumbnailWidth, thumbnailHeight );
	    });

	    uploader.on( 'uploadSuccess', function(file, response) {
	        $( '#'+file.id ).addClass('upload-state-done');
			$("#logo").val(response.datas);
	    });

	    uploader.on( 'uploadError', function( file ) {
	        var $li = $( '#'+file.id ),
	            $error = $li.find('div.error');
	        if ( !$error.length ) {
	            $error = $('<div class="error"></div>').appendTo( $li );
	        }

	        $error.text('上传失败');
	    });

	    uploader.on( 'uploadComplete', function( file ) {
	        $( '#'+file.id ).find('.progress').remove();
	    });

		/*背景图上传*/
		uploader_back = WebUploader.create({
	        auto: true,
	        swf: 'lib/webuploader/0.1.5/Uploader.swf',
	        server: '<%=path%>/backstage/common/uploadPic',
				pick : '#filePicker_back',
				accept : {
					title : 'Images',
					extensions : 'gif,jpg,jpeg,bmp,png',
					mimeTypes : 'image/jpg,image/jpeg,image/png'
				},
				formData : {
					foldername : 'logo'
				}
			});

			uploader_back
					.on(
							'fileQueued',
							function(file) {
								var $li = $('<div id="' + file.id + '" class="file-item thumbnail">'
										+ '<img>'
										+ '<div class="info">'
										+ file.name + '</div>' + '</div>'), $img = $li
										.find('img');

								$list_back.append($li);
								uploader_back.makeThumb(file, function(error,
										src) {
									if (error) {
										$img.replaceWith('<span>不能预览</span>');
										return;
									}

									$img.attr('src', src);
								}, thumbnailWidth, thumbnailHeight);
							});

			uploader_back.on('uploadSuccess', function(file, response) {
				$('#' + file.id).addClass('upload-state-done');
				$("#back_img").val(response.datas);
			});

			uploader_back.on('uploadError', function(file) {
				var $li = $('#' + file.id), $error = $li.find('div.error');
				if (!$error.length) {
					$error = $('<div class="error"></div>').appendTo($li);
				}

				$error.text('上传失败');
			});

			uploader_back.on('uploadComplete', function(file) {
				$('#' + file.id).find('.progress').remove();
			});

		});
	</script>
</body>
</html>

